python pandas change column values to all caps

48

pandas convert all column names to lowercase -

# rename Pandas columns to lower case
df.columns= df.columns.str.lower()
df.columns
Index(['column1', 'column2', 'column3'], dtype='object')

convert all colnames of dataframe to upper -

data.columns = map(str.lower, data.columns)

convert all colnames of dataframe to upper -

data.columns = [x.lower() for x in data.columns]

Comments

Submit
0 Comments